Bit Blaster - Beispiele in Assembler
Suche
Index
FAQ
Kontakt
Zurück

Beispiele in Assembler


ROM-READ

Ein erster Test mit einem ROM aus einem MPP 1361-Drucker, das sich als letztlich als CBM 8023P-ROM enpuppte. Es lässt sich erahnen, dass sich auf Basis dieses Quelltextes auch ein Chip-Programmer realisieren lässt.
Besonders für 5V-Flashs, die auch Page-Mode unterstützen, hat man damit gute Möglichkeiten. Aber auch alte Eprommer, die einen hohen VPP-Pegel brauchen, lassen sich mit einem zusätzlichen TL497 aufbauen.

ROM ROM

ROM ROM
Auf den Fotos erkennt man den kleinen Aufbau und zwei Dumps im SMON.


!to "romread.prg",cbm
;--------------------------------------------------
; 8Kbyte - 2364 ROM Read
;--------------------------------------------------
;
;  Chip Address $01 : PortA = A0-A7
;                     PortB = A8-A12
;  Chip Address $00 : PortA = D0-D7
;
;  /CS - GND
;--------------------------------------------------
; Reads ROM in something around 0,5Kbyte/s
;
; 31.1.2016 M. Sachse http://www.cbmhardware.de
;--------------------------------------------------

 ioport      = $df01
 t_lo        = $0a
 t_hi        = $0b
 outbuf      = $0c
 inbuf       = $0d
 x_temp      = $0f

* = $1000
;--------------------------------------------------
; Setup Ports
;--------------------------------------------------
;
;---[ Write first Init to Expanders
;
           lda #$93
           jsr $ffd2
+          ldy #$00                     ; init chip
           sty count
           sty lo_addr
           lda #%00000000
           sta ioport                   ; flip to low: chip selected
-          lda port_init,y
           sta outbuf
           jsr send_byte                ; send sequence to use address-pins
           iny
           cpy #$03                     ; 3 bytes: $40 (+w),registers,value
           bne -
           lda #%00000001               ; flip to high: chip deselected
           sta ioport
;---[ Set Direction-Register and Pullups Chip: A=0:PortA
;
           lda #%00000000               ; set direction-register
           sta ioport                   ; flip to low: chip selected
           lda #$40
           sta outbuf
           jsr send_byte
           lda #$00                     ; 00h: IODIRA
           sta outbuf
           jsr send_byte
           lda #$ff                     ; port input (D0-D7)
           sta outbuf
           jsr send_byte
           lda #%00000001               ; flip to high: chip deselected
           sta ioport
; Set Pullups
           lda #%00000000
           sta ioport                   ; flip to low: chip selected
           lda #$40
           sta outbuf
           jsr send_byte
           lda #$0c                     ; 0ch: GPPUA
           sta outbuf
           jsr send_byte
           lda #$ff                     ; pullups on port set
           sta outbuf
           jsr send_byte
           lda #%00000001               ; flip to high: chip deselected
           sta ioport

;---[ Set Direction-Register Chip: A=1:PortA and PortB
;
           lda #%00000000               ; set direction-register
           sta ioport                   ; flip to low: chip selected
           lda #$42
           sta outbuf
           jsr send_byte
           lda #$00                     ; 00h: IODIRA
           sta outbuf
           jsr send_byte
           lda #$00                     ; port output (A0-A7)
           sta outbuf
           jsr send_byte
           lda #%00000001               ; flip to high: chip deselected
           sta ioport
;PortB to output
           lda #%00000000               ; set direction-register
           sta ioport                   ; flip to low: chip selected
           lda #$42
           sta outbuf
           jsr send_byte
           lda #$01                     ; 01h: IODIRB
           sta outbuf
           jsr send_byte
           lda #$00                     ; port output (A8-A12)
           sta outbuf
           jsr send_byte
           lda #%00000001               ; flip to high: chip deselected
           sta ioport
;--------------------------------------------------
;
; Address and read ROM
;
;--------------------------------------------------
           sei
           lda #"."
           sta $0400
           ldy #$00
           lda #$30                     ; storage at $3000-$4fff
           sta t_hi
           ldx #$00
           stx t_lo
--         txa
           sta lo_addr
           sta x_temp
; set low address-bits
           lda #%00000000               ; set address A0-A7
           sta ioport                   ; flip to low: chip selected
           lda #$42
           sta outbuf
           jsr send_byte
           lda #$14                     ; 14h:OLATA
           sta outbuf
           jsr send_byte
           lda lo_addr
           sta outbuf
           jsr send_byte
           lda #%00000001               ; flip to high: chip deselected
           sta ioport
; get byte from port
           lda #%00000000
           sta ioport                   ; flip to low: chip selected
           lda #$41
           sta outbuf
           jsr send_byte
           lda #$12                     ; 12h:GPIOA
           sta outbuf
           jsr send_byte
; read byte
           ldx #$00
-          lda #%00000010               ; set clock
           sta ioport
           lda ioport
           and #%00001000
           beq +                        ; write "0"
           lda inbuf
           ora or_table,x
           sta inbuf
+          and #%00000000               ; clock low
           sta ioport
           inx
           cpx #$08
           bne -
           lda #%00000001               ; flip to high: chip deselected
           sta ioport
           lda x_temp
           tay
           tax
           lda inbuf
           sta (t_lo),y                 ; save ROM at $3000-$4fff
           and #$00
           sta inbuf
           inx
           bne --
           inc t_hi
           inc count
; set high address-bits
           lda #%00000000               ; set address A8-A12
           sta ioport                   ; flip to low: chip selected
           lda #$42
           sta outbuf
           jsr send_byte
           lda #$15                     ; 15h:OLATB
           sta outbuf
           jsr send_byte
           lda count
           sta outbuf
           jsr send_byte
           lda #%00000001               ; flip to high: chip deselected
           sta ioport
           ldy count
           lda #"."                     ; drop some points ...
           sta $0400,y
           ldx #$00
           cpy #$20                     ; 32*256=8192 Bytes
           beq ++
           jmp --
++         cli
           rts
count:   !by $00
lo_addr: !by $00
;----------------------------
; send_byte
;
;   x-reg: bit counter
;   carry: bit carrier
;
;----------------------------
send_byte:
          ldx #$00
          txa
--        lda #$00
          asl outbuf         ; shift left: [Carry<-msb...lsb]
          bcc +
; --- send high bit ---------
          ora #%00000100     ; set bit
          sta ioport
          ora #%00000110     ; set clock
          sta ioport
          and #%00000100     ; set clock to low
          sta ioport
          clc
          inx
          cpx #$08
          bne --
          rts
; --- send low bit ----------
+         ora #%00000000     ; set bit
          sta ioport
          ora #%00000010     ; set clock
          sta ioport
          and #%00000000     ; clock to low
          sta ioport
++        inx
          cpx #$08
          bne --
          ldx #$00
          rts
port_init: !by $40,$0a,$08
or_table: !by $80,$40,$20,$10,$08,$04,$02,$01

 

Letzte Änderung: 2019-01-03 12:02:35
  Rubrik:  DIY : Do it yourself
Rubriken-Übersicht
 4 Besucher online 

Valid XHTML 1.0 Transitional Valid CSS!