base:reu_detect
Differences
This shows you the differences between two versions of the page.
Last revisionBoth sides next revision | |||
base:reu_detect [2015-04-17 04:33] – created - external edit 127.0.0.1 | base:reu_detect [2023-10-26 20:21] – groepaz | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== REU Detect ====== | ====== REU Detect ====== | ||
< | < | ||
- | ;-------------------------------------------------------------------------------------------------------------------- | + | ;ACME 0.97 |
- | ; REUDETECT v1.0a ( REU : 1700, 1764, 1750, 1024Kb and 2048Kb ) | + | |
- | ; --------------------------------------------------------------------------------------------------------------------- | + | !addr |
- | ; Overview : Detection of REC and RAM-Type : 0 = 1700 (64Kbx1) or 16 = 1764/50 or bigger(256Kbx1). | + | REUCOMMAND_STASH |
- | ; Write to Registers 2-5 and compare. | + | |
- | ; Write 33 banks with "messy datas" | + | !addr { |
- | ; Fetch bank, inc bank-counter (banks | + | |
- | ; Stash bank, write own dummy bytes for later comparing and fetch next bank. | + | |
- | ; Skip bankcheck if dummy byte-chain found. Detection is finished. | + | |
- | ; Read available banks, evaluate and drop some text on the screen. | + | |
- | ; --------------------------------------------------------------------------------------------------------------------- | + | |
- | ; 21. Januar 2005 M. Sachse (cbmhardware/ | + | |
- | ; | + | |
- | ; E-Mail : info(at)cbmhardware.de | + | } |
- | ; | + | |
- | ; 22. Januar 2005 : Bugfix, add ram-type detection 1764, Vice and C64 compatibility, | + | detect_capacity ; returns A = number of RAM banks found in REU (Carry set means 256, 0 means NO REU) |
- | ; | + | |
- | ; ------------------------------------------------------------------------------------------------------------------ | + | ; first write signatures to banks in *descending* order (banks 255..0): |
- | ; GPL | + | ---- dex |
- | ; | + | stx banknum |
- | ; This program is free software; you can redistribute it and/or modify it under the terms of the | + | |
- | ; GNU General Public License as published by the Free Software Foundation; either version 2 of the | + | ldx #> |
- | ; License, or (at your option) any later version. | + | ldy # |
- | ; | + | jsr set_registers_AXY |
- | ; | + | ; all banks written? |
- | ; Source Code for ACME Cross-Assembler : | + | ldx banknum |
- | ; | + | bne ---- |
- | !to " | + | ; now check signatures in *ascending* order: |
- | + | ; (checking signatures could be shortened by using the REC's " | |
- | *= $0800 | + | ; but I'm reluctant to use this function |
- | + | ; be buggy in modern FPGA implementations because it is so seldomly used) | |
- | !byte $00, | + | ; banknum just became zero so no need to init it |
- | + | ---- lda #< | |
- | *= $080e | + | ldx #> |
- | + | | |
- | reubase | + | jsr set_registers_AXY |
- | reucommand | + | ; compare data |
- | banks | + | ldx # |
- | + | -- | |
- | + | cmp signature_start, | |
- | ; | + | bne @failed |
- | ; Detect REU 1700, | + | dex |
- | ; | + | bpl -- |
- | reudetect | + | ; bank has correct signature |
- | | + | inc banknum |
- | lda #00 | + | bne ---- |
- | sta $d020 | + | ; there are actually 256 banks! |
- | sta $d021 | + | |
- | | + | lda banknum |
- | sta reubase | + | rts |
- | cmp reubase | + | |
- | beq noreu | + | @failed |
- | bne unsafe | + | lda banknum |
- | unsafe | + | |
- | and #16 ; check bit 4 for REU mem | + | |
- | cmp #16 ; 16 = 256Kbx1 | + | set_registers_AXY |
- | beq regcheck | + | ; A/X: c64 address |
- | bne l1 ; no, 1700 ? | + | ; Y: REU command |
- | l1 lda reubase | + | sta reu_c64addr_lo |
- | and #16 ; check bit 4 for REU mem | + | stx reu_c64addr_hi |
- | cmp #0 | + | |
- | beq r1700 | + | stx reu_extaddr_lo |
- | bne noreu ; | + | stx reu_extaddr_hi |
- | regcheck | + | lda banknum |
- | ldx #2 | + | sta reu_extaddr_bank |
- | loop1 txa | + | |
- | sta $df00, | + | |
- | inx | + | stx reu_len_hi |
- | cpx #5 | + | sty reu_command |
- | bne loop1 | + | rts |
- | ldx #02 | + | |
- | loop2 txa | + | ; signature we write to REU banks, first byte is bank number |
- | cmp $df00, | + | signature_start |
- | bne noreu | + | banknum |
- | inx | + | |
- | cpx #5 | + | |
- | bne loop2 | + | ; target buffer when reading signatures back from REU |
- | jmp rinit | + | sig_candidate_start |
- | r1700 lda #< | + | |
- | ldy #> | + | sig_candidate_end |
- | jmp $ab1e | + | |
- | ; | + | |
- | rinit ldx #00 | + | |
- | rinit2 | + | |
- | sta config | + | |
- | lda #$12 ; write some crap in ... | + | |
- | sta c64hi+1 | + | |
- | stx bank+1 | + | |
- | jsr main | + | |
- | inx | + | |
- | cpx #33 | + | |
- | bne rinit2 | + | |
- | jmp action | + | |
- | noreu lda #< | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | |
- | ;-------------------------------------------------- | + | |
- | ; Count banks | + | |
- | ;-------------------------------------------------- | + | |
- | action | + | |
- | | + | |
- | stx bank+1 | + | |
- | check lda #129 ; fetch : transfer to C64 : $1300 | + | |
- | sta config | + | |
- | lda #$13 ; C64 : $1300 | + | |
- | sta c64hi+1 | + | |
- | jsr main | + | |
- | lda #128 ; stash | + | |
- | sta config | + | |
- | lda #$0A ; write dummy bytes from $0900 | + | |
- | sta c64hi+1 | + | |
- | jsr main | + | |
- | jsr bankcheck | + | |
- | inx | + | |
- | cpx #33 | + | |
- | | + | |
- | | + | |
- | ; | + | |
- | lda #0 ; restore bordercolor | + | |
- | sta $d020 | + | |
- | lda banks ; banks found ? | + | |
- | cmp #4 | + | |
- | beq r1764 | + | |
- | bne j1 | + | |
- | r1764 | + | |
- | sta banks | + | |
- | lda #< | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | |
- | j1 cmp #8 | + | |
- | beq r512 | + | |
- | bne j2 | + | |
- | r512 lda #< | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | |
- | j2 cmp #16 | + | |
- | beq r1024 | + | |
- | bne j3 | + | |
- | r1024 | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | |
- | j3 cmp #20 | + | |
- | beq r1764 | + | |
- | bne j4 | + | |
- | j4 cmp #32 | + | |
- | beq r2048 | + | |
- | bne j6 | + | |
- | r2048 lda #< | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | |
- | j6 lda #< | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | |
- | ;-------------------------------------------------- | + | |
- | ; Bank Check | + | |
- | ;-------------------------------------------------- | + | |
- | bankcheck | + | |
- | l2 lda $0A00,y | + | |
- | l6 cmp $1300, | + | |
- | bne l4 ; bank found ? | + | |
- | beq l3 ; no, check 16 Bytes | + | |
- | l3 | + | |
- | | + | |
- | bne l2 ; loop | + | |
- | end ldy #00 | + | |
- | | + | |
- | delete | + | |
- | iny | + | |
- | | + | |
- | bne delete | + | |
- | rts | + | |
- | l4 jmp l5 | + | |
- | l5 inc banks ; bank found (inc), border color change and exit | + | |
- | inc $d020 | + | |
- | rts | + | |
- | config !byte 252 | + | |
- | ;-------------------------------------------------- | + | |
- | ; Bytes and text | + | |
- | ; | + | |
- | *=$0A00 | + | |
- | + | ||
- | !scr " | + | |
- | + | ||
- | reutext: | + | |
- | text1764: !text "REU 1764 : 256KB DETECTED", | + | |
- | reut512: | + | |
- | reut1024: !text "REU 1024KB DETECTED" | + | |
- | reut2048: !text "REU 2048KB DETECTED",0 | + | |
- | reuunk: | + | |
- | notext: | + | |
- | + | ||
- | ;-------------------------------------------------- | + | |
- | ; REU TRANSFER ROUTINE | + | |
- | ; | + | |
- | + | ||
- | main | + | |
- | lda config | + | |
- | sta reubase+1 | + | |
- | lda #$00 | + | |
- | sta reubase+2 | + | |
- | c64hi lda #$09 | + | |
- | sta reubase+3 | + | |
- | lda #$00 | + | |
- | sta reubase+4 | + | |
- | sta reubase+5 | + | |
- | bank lda #0 | + | |
- | sta reubase+6 | + | |
- | rbytes | + | |
- | sta reubase+7 | + | |
- | lda #$00 | + | |
- | sta reubase+8 | + | |
- | irq lda #$00 | + | |
- | sta reubase+9 | + | |
- | lda #$00 | + | |
- | sta reubase+10 | + | |
- | lda $1 | + | |
- | pha | + | |
- | lda #$30 ; RAM | + | |
- | sei | + | |
- | sta $1 | + | |
- | sta $ff00 | + | |
- | pla | + | |
- | sta $1 | + | |
- | cli | + | |
- | rts | + | |
</ | </ |
base/reu_detect.txt · Last modified: 2023-10-26 20:24 by groepaz