base:reu_detect
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
base:reu_detect [2015-04-17 04:33] – created - external edit 127.0.0.1 | base:reu_detect [2023-10-26 20:24] (current) – 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, | + | |
- | ; | + | |
- | ; ------------------------------------------------------------------------------------------------------------------ | + | |
- | ; GPL | + | |
- | ; | + | |
- | ; 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 | + | |
- | ; License, or (at your option) any later version. | + | |
- | ; | + | |
- | ; | + | |
- | ; Source Code for ACME Cross-Assembler : | + | |
- | ; | + | |
- | !to " | + | |
- | *= $0800 | + | ; returns: |
- | + | ; Carry = 0, A = 0 NO REU detected | |
- | !byte $00, | + | ; |
- | + | ; | |
- | *= $080e | + | detect_capacity |
- | + | ldx # | |
- | reubase | + | ; first write signatures to banks in *descending* order (banks 255..0): |
- | reucommand | + | ---- dex |
- | banks | + | stx banknum |
- | + | lda #< | |
- | + | | |
- | ;-------------------------------------------------- | + | |
- | ; Detect REU 1700, | + | jsr set_registers_AXY |
- | ; | + | ; all banks written? |
- | reudetect | + | ldx banknum |
- | sta $0286 ; textcolor white | + | bne ---- |
- | lda #00 | + | ; now check signatures in *ascending* order: |
- | sta $d020 | + | ; (checking signatures could be shortened by using the REC's " |
- | sta $d021 | + | ; but I'm reluctant to use this function in a "REU detect" |
- | | + | ; be buggy in modern FPGA implementations because it is so seldomly used) |
- | sta reubase | + | ; banknum just became zero so no need to init it |
- | cmp reubase | + | ---- |
- | beq noreu | + | ldx #> |
- | bne unsafe | + | ldy # |
- | unsafe | + | jsr set_registers_AXY |
- | and #16 | + | |
- | cmp #16 | + | ldx #SIGNATURE_LENGTH_LOW - 1 |
- | beq regcheck | + | -- lda sig_candidate_start, |
- | bne l1 ; no, 1700 ? | + | cmp signature_start, x |
- | l1 lda reubase | + | bne @failed |
- | and #16 ; check bit 4 for REU mem | + | dex |
- | cmp #0 | + | |
- | beq r1700 | + | ; bank has correct signature |
- | bne noreu ; no ram-type, no reu, no fun ... | + | inc banknum |
- | regcheck | + | bne ---- |
- | | + | ; there are actually 256 banks! |
- | loop1 txa | + | sec |
- | sta $df00, | + | lda banknum |
- | inx | + | |
- | cpx #5 | + | |
- | bne loop1 | + | @failed |
- | ldx #02 | + | lda banknum |
- | loop2 txa | + | rts |
- | | + | |
- | | + | set_registers_AXY |
- | inx | + | ; A/X: c64 address |
- | cpx #5 | + | ; Y: REU command |
- | bne loop2 | + | sta reu_c64addr_lo |
- | jmp rinit | + | |
- | r1700 lda #< | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | stx reu_extaddr_hi |
- | ; | + | lda banknum |
- | rinit ldx #00 | + | sta reu_extaddr_bank |
- | rinit2 | + | lda #SIGNATURE_LENGTH_LOW |
- | sta config | + | sta reu_len_lo |
- | lda #$12 ; write some crap in ... | + | stx reu_len_hi |
- | sta c64hi+1 | + | sty reu_command |
- | | + | rts |
- | jsr main | + | |
- | inx | + | ; signature we write to REU banks, |
- | cpx #33 ; ... 33 banks into somewhere | + | signature_start |
- | | + | banknum |
- | jmp action | + | SIGNATURE_LENGTH_LOW = * - signature_start |
- | noreu lda #< | + | |
- | ldy #> | + | ; target buffer when reading signatures back from REU |
- | jmp $ab1e | + | sig_candidate_start |
- | ; | + | !tx "XBLIBLABLUB" |
- | ; Count banks | + | sig_candidate_end |
- | ; | + | |
- | action | + | |
- | ldx #$00 | + | |
- | stx bank+1 | + | |
- | check | + | |
- | 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 | + | |
- | stx bank+1 | + | |
- | bne check | + | |
- | ;-------------------------------------------------- | + | |
- | lda #0 ; restore bordercolor | + | |
- | sta $d020 | + | |
- | lda banks ; banks found ? | + | |
- | cmp #4 | + | |
- | beq r1764 | + | |
- | bne j1 | + | |
- | r1764 | + | |
- | | + | |
- | lda #< | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | |
- | j1 cmp #8 | + | |
- | beq r512 | + | |
- | bne j2 | + | |
- | r512 lda #< | + | |
- | ldy #> | + | |
- | jmp $ab1e | + | |
- | j2 cmp #16 | + | |
- | beq r1024 | + | |
- | bne j3 | + | |
- | r1024 lda #< | + | |
- | 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 | + | |
- | cpy #16 | + | |
- | bne l2 ; loop | + | |
- | end ldy #00 | + | |
- | lda #00 | + | |
- | delete | + | |
- | iny | + | |
- | cpy #16 | + | |
- | bne delete | + | |
- | rts | + | |
- | l4 jmp l5 | + | |
- | l5 | + | |
- | inc $d020 | + | |
- | rts | + | |
- | config !byte 252 | + | |
- | ; | + | |
- | ; Bytes and text | + | |
- | ; | + | |
- | *=$0A00 | + | |
- | + | ||
- | !scr "---C64-RULEZ!---" | + | |
- | | + | |
- | reutext: | + | |
- | text1764: !text "REU 1764 : 256KB DETECTED", | + | |
- | reut512: | + | |
- | reut1024: !text "REU 1024KB DETECTED", | + | |
- | reut2048: !text "REU 2048KB DETECTED", | + | |
- | 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.1429238018.txt.gz · Last modified: 2015-04-17 04:33 by 127.0.0.1