Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; 10 SYS2064
- *=$0801
- BYTE $0B, $08, $0A, $00, $9E, $32, $30, $36, $34, $00, $00, $00
- *=2064
- jmp Main
- scrline byte 0,0,0,0,0,0,0,0,0,0
- linnum byte 0
- mystring byte 0,0,0,0,0,0,0,0
- ScrnBase = $0400
- ScrnCol = $d800
- _pnt1 = $3
- _pnt2 = $5
- _pnt3 = $b7
- _pnt4 = $b9
- _pnt5 = $bb
- _Snot = $8000
- _Snot1 = _Snot + $100
- _Snot2 = _Snot + $200
- _Snot3 = _Snot + $300
- _Snot4 = _Snot + $400
- _Snot5 = _Snot + $500
- _Snot6 = _Snot + $600
- _Snot7 = _Snot + $700
- _Snot8 = _Snot + $800
- _Snot9 = _Snot + $900
- _Sblk = _Snot + $A00
- _Smat = _Snot + $B00
- _Sgblk = _Snot + $C00
- _SXY = _Snot + $80
- fmod =$60
- _rnVal =$2
- _rnDsp byte 0
- _rnY =$61
- _rnX =$62
- _strcell byte 0, 0
- _fsaN =$a3
- _fsaF =$a4
- _fsaC =$a5
- _frcF =$a6
- _fsY =$a7
- _rnEF =$a8
- sIndic byte '-->',0
- sClear byte ' ',0
- kSel byte 0
- kSelp byte 0
- kDown = 17
- kUp = 145
- kRet = 13
- _mnu1 byte 6,6,'1. subloku facile',0
- _mnu2 byte 7,6,'2. subloku medio',0
- _mnu3 byte 8,6,'3. subloku difficile 1',0
- _mnu4 byte 9,6,'4. subloku difficile 2',0
- _mnu5 byte 10,6,'5. sudoku facile',0
- _mnu6 byte 11,6,'6. sudoku difficile',0
- _mnu7 byte 12,6,'7. esci',0
- StrTable
- byte <_mnu1, >_mnu1
- byte <_mnu2, >_mnu2
- byte <_mnu3, >_mnu3
- byte <_mnu4, >_mnu4
- byte <_mnu5, >_mnu5
- byte <_mnu6, >_mnu6
- byte <_mnu7, >_mnu7
- _tim byte 0,0,0
- _tem byte "tempo: ",0
- _sec byte " sec",0
- ; ------------------------------------------------------
- Main
- ldy #>_SXY ; calcolo della matrice delle coordinate XY
- sty _pnt1+1 ; utile in alcune elaborazioni
- iny
- sty _pnt2+1
- lda #<_SXY
- sta _pnt1
- sta _pnt2
- ldy #0
- ldx #1
- txa
- _plp sta _rnY
- sta (_pnt2),y
- txa
- sta (_pnt1),y
- lda _rnY
- iny
- inx
- cpx #10
- bne _plp
- ldx #1
- clc
- adc #1
- cmp #10
- bne _plp
- lda #1
- sta kSel
- sta kSelp
- Main2
- lda #32
- ldy #8
- jsr ClearScreen
- jsr WriteMenu
- _RK clc ; legge un tasto
- lda kSelp
- adc #5
- tay
- ldx #3
- jsr SetCurs
- lda #<sClear
- ldx #>sClear
- jsr PrintAt
- clc ; disegna la freccia di indicazione
- lda kSel
- adc #5
- tay
- ldx #3
- jsr SetCurs
- lda #<sIndic
- ldx #>sIndic
- jsr PrintAt
- _read jsr $F142
- beq _read
- tax
- CLC
- ADC #$c8 ; make m = $FF
- ADC #7 ; carry set if in range n to m
- bcs KeyNum
- cpx #kDown
- beq KeyDwn
- cpx #kUp
- beq KeyUp
- cpx #kRet ; la scelta è <Return>
- bne _RK
- jmp Prep
- KeyNum ; la scelta è un numero
- lda kSel
- sta kSelp
- txa
- sec
- sbc #"0"
- sta kSel
- jmp _RK
- KeyDwn lda kSel ; la scelta è CrsrDown
- sta kSelp
- cmp #7
- beq _RK
- inc kSel
- bne _RK
- KeyUp lda kSel ; la scelta è CrsrUp
- sta kSelp
- cmp #1
- beq _RK
- dec kSel
- bne _RK
- ; ------------------------------------------------------
- ; scrive il menù
- ; ------------------------------------------------------
- WriteMenu
- lda #0
- sta 53281
- lda #12
- tax
- _wmlp
- pha
- lda strtable,x
- sta _pnt1
- pha
- lda strtable+1,x
- sta _pnt1+1
- pha
- ldy #1
- lda (_pnt1),y
- tax
- dey
- lda (_pnt1),y
- tay
- jsr SetCurs
- pla
- tax
- pla
- ldy #2
- jsr PrintAt+2
- pla
- tax
- dex
- dex
- txa
- bpl _wmlp
- rts
- ; ------------------------------------------------------
- ; prepara la schermata di gioco, in base alla selezione
- ; ------------------------------------------------------
- Prep
- lda #32
- jsr ClearScreen
- lda kSel
- cmp #7
- bne _pchk1
- lda #6
- sta 53281
- rts
- _pchk1 cmp #1
- bne _pchk2
- lda #<_1num
- sta _pnt4
- lda #>_1num
- sta _pnt4+1
- lda #<_1blk
- sta _pnt5
- lda #>_1blk
- sta _pnt5+1
- jmp _pnxt
- _pchk2 cmp #2
- bne _pchk3
- lda #<_2num
- sta _pnt4
- lda #>_2num
- sta _pnt4+1
- lda #<_2blk
- sta _pnt5
- lda #>_2blk
- sta _pnt5+1
- jmp _pnxt
- _pchk3 cmp #3
- bne _pchk4
- lda #<_3num
- sta _pnt4
- lda #>_3num
- sta _pnt4+1
- lda #<_3blk
- sta _pnt5
- lda #>_3blk
- sta _pnt5+1
- jmp _pnxt
- _pchk4 cmp #4
- bne _pchk5
- lda #<_4num
- sta _pnt4
- lda #>_4num
- sta _pnt4+1
- lda #<_3blk
- sta _pnt5
- lda #>_3blk
- sta _pnt5+1
- jmp _pnxt
- _pchk5 cmp #5
- bne _pchk6
- lda #<_5num
- sta _pnt4
- lda #>_5num
- sta _pnt4+1
- lda #<_5blk
- sta _pnt5
- lda #>_5blk
- sta _pnt5+1
- jmp _pnxt
- _pchk6 cmp #6
- lda #<_6num
- sta _pnt4
- lda #>_6num
- sta _pnt4+1
- lda #<_5blk
- sta _pnt5
- lda #>_5blk
- sta _pnt5+1
- _pnxt
- lda #9
- sta linnum
- jsr ResetBoard
- jsr GetTime
- jsr ReduceNotes
- _lpcop clc ; prepara una linea dello Schema per disegnarla a video
- ldy #8
- _lplin lda (_pnt4),y
- beq _revon
- adc #$10 ; aggiunge $30 per un numero, $20 per spazio
- _revon adc #$20
- ora #$80 ; attiva reverse
- sta scrline,y
- dey
- bpl _lplin
- ldx #5 ; disegna i numeri
- lda #5
- adc #8
- sbc linnum
- tay
- jsr SetCurs
- lda _pnt2
- sta _pnt3
- lda #$d4
- adc _pnt2+1
- sta _pnt3+1
- lda #<scrline
- ldx #>scrline
- jsr PrintAt
- ldy #9 ; disegna (assegna) i colori
- _lpcol lda (_pnt5),y
- sta (_pnt3),y
- dey
- bpl _lpcol
- lda #9
- adc _pnt4
- sta _pnt4
- lda #0
- adc _pnt4+1
- sta _pnt4+1
- lda #9
- adc _pnt5
- sta _pnt5
- lda #0
- adc _pnt5+1
- sta _pnt5+1
- dec linnum
- bne _lpcop
- jsr MainLoop
- _read1 jsr $F142 ; attende <Return>
- beq _read1
- cmp #13
- bne _read1
- jmp Main2
- ; ------------------------------------------------------
- MainLoop
- jsr RecalcNotes
- lda #0
- sta fmod
- jsr FindSingleInCell
- lda _rnEF
- beq _endmainloop
- lda fmod
- bne MainLoop
- jsr FindSingleInArea
- lda _rnEF
- beq _endmainloop
- lda fmod
- bne MainLoop
- jsr FindRowColToBlock
- lda fmod
- bne MainLoop
- _endmainloop
- sei ; time
- sec
- lda $a2
- sbc _tim+2
- sta _tim+2
- lda $a1
- sbc _tim+1
- sta _tim+1
- lda $a0
- sbc _tim
- sta _tim
- cli
- jsr PrintTime
- rts
- ; ------------------------------------------------------
- ; cerca una cella che abbia un solo candidato
- ; ------------------------------------------------------
- FindSingleInCell
- ldy #81-1 ; scorre tutta la matrice
- lda #>_Snot
- sta _pnt1+1
- sta _pnt2+1
- ldx #0
- stx _pnt1
- stx _pnt2
- _fsslp2 lda (_pnt1),y
- cmp #1
- beq _fsslp4
- _fsslp3 dey
- bpl _fsslp2
- rts
- _fsslp4 sta fmod
- _fsslp5 inx
- inc _pnt2+1
- lda (_pnt2),y
- beq _fsslp5
- txa
- sta _rnVal
- sta _Smat,y
- jsr DisplayCell
- jsr SetCellAndNotes
- jmp RecalcNotes
- ; ------------------------------------------------------
- ; cerca riga/colonna/blocco che abbia il candidato per
- ; un valore in una sola cella
- ; ------------------------------------------------------
- FindSingleInArea
- ; FindSingleInRow
- ; cerca per riga
- lda #9
- sta _fsaN
- _fsalp1 ldx #0
- ldy #0
- stx _pnt1
- lda #>_Snot
- clc
- adc _fsaN
- sta _pnt1+1
- _fsalp7 lda #2
- sta _fsaF
- jmp _fsalp3
- _fsalp2 iny
- cpy #81
- bcs _fsalp6
- inx
- cpx #9
- bne _fsalp3 ; end loop
- lda _fsaF
- cmp #1
- bne _fsalp4
- ;found!
- jmp Found
- _fsalp3 lda (_pnt1),y
- beq _fsalp2
- sty _fsY
- dec _fsaF
- bne _fsalp2
- _fsalp4 ;not found
- sty _fsY
- txa
- sec
- sbc #9
- eor #$ff
- sec
- adc _fsY
- tay
- ldx #0
- jmp _fsalp7
- _fsalp6 dec _fsaN
- bne _fsalp1
- ;jmp FindSingleInCol
- ; FindSingleInCol
- ; cerca per colonna
- lda #9 ; cerca la tabella di un certo valore
- sta _fsaN
- _fsclp1 ldy #8
- sty _fsaC ; loop varie note
- lda _fsaN ; punta alla tabella
- clc ; .
- adc #>_Snot1-1 ; .
- sta _pnt1+1 ; .
- lda #0 ; .
- sta _pnt1 ; .
- _fsclp2 lda #2 ; loop colonne per ogni nota
- sta _fsaF ; non più di un elemento da trovare
- ldx #9 ; 9 elementi da controllare
- ldy _fsaC
- jmp _fsclp5
- _fsclp3 dex ; loop di controllo colonna
- bne _fsclp4
- lda _fsaF
- cmp #1
- bne _fsclp6
- ;found!
- jmp Found
- _fsclp4 tya
- clc
- adc #9
- tay
- _fsclp5 lda (_pnt1),y
- beq _fsclp3
- sty _fsY
- dec _fsaF
- bne _fsclp3
- _fsclp6 dec _fsaC
- bne _fsclp2
- dec _fsaN
- bne _fsclp1
- ; FindSingleInBlock
- ; cerca nei blocchi
- lda #0
- sta _pnt1
- lda #$90
- _fsblp3 sta _fsbdst+1 ; ciclo sui valori
- lda #9
- sta _fsaN
- _fsblp5 lda _fsaN
- clc
- adc #>_Snot1-1
- sta _pnt1+1
- lda #2
- sta _fsaF
- ldx #9
- jmp _fsbdst
- _fsblp1 dex
- bne _fsbdst
- lda _fsaF
- cmp #1
- bne _fsblp6
- ;found!
- jmp Found
- _fsbdst lda _Sgblk,x
- tay
- lda (_pnt1),y
- beq _fsblp1
- sty _fsY
- dec _fsaF
- bne _fsblp1
- _fsblp6 dec _fsaN
- bne _fsblp5
- _fsblp4 lda _fsbdst+1
- sec
- sbc #$10
- bne _fsblp3
- rts
- ; ------------------------------------------------------
- Found
- sta fmod
- ldy _fsY
- lda _fsaN
- sta _rnVal
- sta _Smat,y
- jsr DisplayCell
- jsr SetCellAndNotes
- jmp RecalcNotes
- ; ------------------------------------------------------
- ; cerca blocchi in cui le note siano tutte in una riga/colonna
- ; ------------------------------------------------------
- FindRowColToBlock
- lda #0
- sta _pnt1
- lda #$90
- _frclp3 sta _frcdst+1 ; ciclo sui gruppi
- lda #9
- sta _fsaN
- _frclp5 lda _fsaN ; ciclo sui valori
- clc
- adc #>_Snot1-1
- sta _pnt1+1
- ldx #$ff
- stx _rnX
- stx _rnY
- lda #0
- sta _frcF
- ldx #9
- jmp _frcdst
- _frclp1 dex
- beq _frclp2
- _frcdst lda _Sgblk,x
- tay
- lda (_pnt1),y
- beq _frclp1
- lda _frcF
- bne _nxtctrl
- inc _frcF
- lda _SXY,y
- sta _rnX
- lda _SXY+$100,y
- sta _rnY
- jmp _frclp1
- _nxtctrl lda _SXY,y
- cmp _rnX
- beq _checkY
- lda #$ff
- sta _rnX
- cmp _rnY
- beq _frclp6
- _checkY lda _SXY+$100,y
- cmp _rnY
- beq _frclp1
- lda #$ff
- sta _rnY
- cmp _rnX
- bne _frclp1
- _frclp6 dec _fsaN
- bne _frclp5
- _frclp4 lda _frcdst+1
- sec
- sbc #$10
- bne _frclp3
- rts
- _frclp2 lda _rnX
- bmi _frcY
- ldx #9
- tay ; Xpos -> .Y
- dey
- lda _frcdst+1
- lsr
- lsr
- lsr
- lsr
- sta _pnt4+1
- _frclp7 lda _pnt4+1
- cmp _Sblk,y
- beq _nxtrc1
- lda #0
- sta (_pnt1),y
- _nxtrc1 tya
- clc
- adc #9
- tay
- dex
- bne _frclp7
- lda #1
- sta fmod
- jmp _frclp6
- _frcY ldx _rnY
- bmi _frclp6
- clc ; Ypos -> .Y
- lda #0
- jmp _el
- _il adc #9
- _el dex
- bne _il
- ldx #9
- tay
- lda _frcdst+1
- lsr
- lsr
- lsr
- lsr
- sta _pnt4+1
- _frclp8 lda _pnt4+1
- cmp _Sblk,y
- beq _nxtrc2
- lda #0
- sta (_pnt1),y
- _nxtrc2 iny
- dex
- bne _frclp8
- lda #1
- sta fmod
- jmp _frclp6
- ; ------------------------------------------------------
- ; ripristina le matrici allo stato iniziale;
- ; carica lo schema scelto
- ; ------------------------------------------------------
- ResetBoard
- lda #>_Sgblk
- sta _pnt3+1
- lda #0
- sta _pnt3
- ldy #9
- _rblp1 sta (_pnt3),y
- dey
- bne _rblp1
- ldy #81-1
- _rblp2 lda (_pnt4),y ; carica lo schema
- sta _Smat,y
- lda (_pnt5),y ; carica la struttura
- sta _Sblk,y
- tax ; crea tabella array dei blocchi
- asl
- asl
- asl
- asl
- sta _rbdst1+1 ; codice automodificante
- inc _Sgblk,x
- lda _Sgblk,x
- tax
- tya
- _rbdst1 sta _Sgblk,x ; destinazione automodificata
- lda #1 ; azzera i candidati delle celle
- sta _Snot1,y
- sta _Snot2,y
- sta _Snot3,y
- sta _Snot4,y
- sta _Snot5,y
- sta _Snot6,y
- sta _Snot7,y
- sta _Snot8,y
- sta _Snot9,y
- dey
- bpl _rblp2
- rts
- ; ------------------------------------------------------
- ; cerca le celle valorizzate per annullare le note
- ; corrispondenti
- ; ------------------------------------------------------
- ReduceNotes
- ldy #81-1
- _rnlp lda _Smat,y
- beq _rnend
- jsr SetCellAndNotes
- ldy _rnY
- _rnend dey
- bpl _rnlp
- ; ------------------------------------------------------
- RecalcNotes
- ;calcola le note per casella
- lda #0
- sta _rnEF
- ldy #81-1
- _rnslp1 lda #>_Snot1
- sta _pnt1+1
- lda #9
- sta _pnt2
- ldx #0
- stx _pnt1
- _rnslp2 lda (_pnt1),y
- beq _rnslp3
- inx
- stx _rnEF
- _rnslp3 inc _pnt1+1
- dec _pnt2
- bne _rnslp2
- txa
- sta _Snot,y
- dey
- bpl _rnslp1
- rts
- ; ------------------------------------------------------
- ; data una cella valorizzata, annulla le note per quella
- ; cella e le note di quel valore per le celle degli
- ; stessi riga/colonna/blocco
- ; ------------------------------------------------------
- ; richiede A=valore, Y=posizione
- ; ------------------------------------------------------
- SetCellAndNotes
- sta _rnVal
- sty _rnY
- ;azzera note per quella cella
- ldx #9
- lda #>_Snot1
- sta _pnt1+1
- lda #0
- sta _pnt1
- _rnzlop sta (_pnt1),y
- inc _pnt1+1
- dex
- bne _rnzlop
- ;azzera note di quel valore per quella colonna
- clc
- lda #>_Snot1-1
- adc _rnVal
- sta _pnt2+1
- lda #0
- sta _pnt2
- lda _SXY,y
- sec
- sbc #1
- sta _rnX
- tay ;azzera le note della stessa colonna
- ldx #9
- clc
- _rnclp0 lda #0
- sta (_pnt2),y
- tya
- adc #9
- tay
- dex
- bne _rnclp0
- lda _rnY ;azzera le note della stessa riga
- sec
- sbc _rnX
- tay
- ldx #9
- lda #0
- _rnclp1 sta (_pnt2),y
- iny
- dex
- bne _rnclp1
- _rncblk
- clc ;azzera le note per quel blocco
- lda _rnVal
- adc #>_Snot1-1
- sta _pnt1+1
- lda #0
- sta _pnt1
- ldy _rnY
- lda _Sblk,y
- ldy #81-1
- _rnblp1 cmp _Sblk,y
- bne _rnblp2
- lda #0
- sta (_pnt1),y
- lda _Sblk,y
- _rnblp2 dey
- bpl _rnblp1
- rts
- ; ------------------------------------------------------
- DisplayCell
- ora #$80+$30
- sta _strcell
- tya
- sty _rnY
- ldy #$2
- _dclp iny
- sec
- sbc #9
- bpl _dclp
- adc #14
- tax
- jsr SetCurs
- lda #<_strcell
- ldx #>_strcell
- jsr PrintAt
- ldy _rnY
- lda _rnVal
- rts
- ; ------------------------------------------------------
- GetTime
- lda $a0
- sta _tim
- lda $a1
- sta _tim+1
- lda $a2
- sta _tim+2
- rts
- ; ------------------------------------------------------
- PrintTime
- clc
- ldx #15
- ldy #10
- jsr $E50A ; Set Pos: c 10, r 15
- lda #<_tem
- ldy #>_tem
- jsr $ab1e
- lda _tim+2
- ldx _tim+1
- ldy _tim+0
- jsr $af87 ; sets mantissa to 00yyxxaa
- jsr $af7e ; set rest of FAC1 and JMP to $b8d2
- jsr Fac2Arg
- lda #0
- ldy #+60
- jsr $b391 ; convert Y/A (lo/hi) to Fac1
- jsr $bb12 ; FDIVT division ARG/FAC
- jsr Fac2Arg
- lda #0
- ldy #100
- jsr $b391 ; convert Y/A (lo/hi) to Fac1
- jsr $ba30 ; Fac=Arg*Fac
- jsr $bddd ; convert Fac1 to string
- sta _pnt1
- sty _pnt1+1
- ldy #0
- _ptlp lda (_pnt1),y
- sta mystring,y
- iny
- cmp #0
- beq _ptel
- cmp #'.'
- bne _ptlp
- lda #0
- _ptel sta mystring,y
- lda mystring-2,y
- sta mystring-1,y
- lda mystring-3,y
- sta mystring-2,y
- lda #'.'
- sta mystring-3,y
- lda #<mystring
- ldy #>mystring
- jsr $ab1e ; print string pointed by Y/A
- lda #<_sec
- ldy #>_sec
- jsr $ab1e
- rts
- Fac2Arg
- ldx #6
- _l5 lda $61,x ; FAC -> ARG
- sta $69,x
- dex
- bpl _l5
- rts
- _1num
- byte 9, 2, 1, 5, 6, 0, 0, 0, 0
- byte 0, 0, 0, 0, 0, 9, 6, 0, 2
- byte 0, 6, 0, 0, 0, 0, 0, 2, 4
- byte 0, 1, 0, 0, 4, 0, 0, 0, 9
- byte 0, 0, 5, 8, 0, 1, 2, 0, 0
- byte 3, 0, 0, 0, 7, 0, 0, 9, 0
- byte 1, 9, 0, 0, 0, 0, 0, 4, 0
- byte 2, 0, 9, 6, 0, 0, 0, 0, 0
- byte 0, 0, 0, 0, 2, 3, 9, 8, 6
- _1blk
- byte 1, 1, 1, 1, 1, 2, 2, 2, 2
- byte 1, 1, 1, 3, 3, 2, 2, 4, 2
- byte 1, 3, 3, 3, 2, 2, 4, 4, 4
- byte 5, 3, 3, 3, 3, 6, 6, 4, 4
- byte 5, 5, 6, 6, 6, 6, 6, 4, 4
- byte 5, 5, 6, 6, 7, 7, 7, 7, 4
- byte 5, 5, 5, 8, 8, 7, 7, 7, 9
- byte 8, 5, 8, 8, 7, 7, 9, 9, 9
- byte 8, 8, 8, 8, 9, 9, 9, 9, 9
- _2num
- byte 0, 0, 0, 0, 2, 0, 7, 3, 0
- byte 1, 0, 0, 0, 0, 9, 5, 0, 0
- byte 2, 4, 0, 0, 1, 0, 0, 0, 0
- byte 0, 6, 0, 4, 0, 2, 0, 0, 0
- byte 9, 0, 1, 0, 0, 0, 3, 0, 2
- byte 0, 0, 0, 6, 0, 5, 0, 4, 0
- byte 0, 0, 0, 0, 5, 0, 0, 7, 3
- byte 0, 0, 8, 3, 0, 0, 0, 0, 5
- byte 0, 1, 7, 0, 3, 0, 0, 0, 0
- _2blk
- byte 1, 1, 1, 2, 2, 2, 2, 2, 2
- byte 3, 3, 1, 1, 1, 1, 4, 2, 2
- byte 3, 3, 3, 1, 1, 5, 4, 2, 4
- byte 3, 3, 3, 5, 5, 5, 4, 4, 4
- byte 6, 3, 6, 6, 5, 4, 4, 7, 4
- byte 6, 6, 6, 5, 5, 5, 7, 7, 7
- byte 6, 8, 6, 5, 9, 9, 7, 7, 7
- byte 8, 8, 6, 9, 9, 9, 9, 7, 7
- byte 8, 8, 8, 8, 8, 8, 9, 9, 9
- _3num
- byte 0, 0, 0, 2, 0, 1, 7, 0, 0
- byte 0, 1, 4, 0, 0, 0, 0, 0, 0
- byte 0, 7, 0, 0, 4, 0, 0, 0, 1
- byte 3, 0, 0, 0, 2, 0, 0, 0, 6
- byte 0, 0, 8, 1, 0, 3, 5, 0, 0
- byte 8, 0, 0, 0, 9, 0, 0, 0, 3
- byte 1, 0, 0, 0, 3, 0, 0, 7, 0
- byte 0, 0, 0, 0, 0, 0, 9, 4, 0
- byte 0, 0, 1, 9, 0, 7, 0, 0, 0
- _3blk
- byte 1, 1, 1, 2, 2, 2, 2, 2, 2
- byte 1, 1, 1, 2, 3, 3, 3, 3, 2
- byte 1, 1, 1, 2, 3, 3, 4, 3, 3
- byte 5, 5, 5, 6, 6, 4, 4, 3, 4
- byte 5, 7, 7, 6, 6, 6, 4, 4, 4
- byte 5, 7, 7, 8, 6, 6, 6, 9, 4
- byte 5, 7, 8, 8, 8, 6, 9, 9, 4
- byte 5, 7, 7, 7, 8, 9, 9, 9, 9
- byte 5, 5, 7, 8, 8, 8, 8, 9, 9
- _4num
- byte 0, 0, 0, 2, 0, 1, 7, 0, 0
- byte 0, 0, 4, 0, 0, 0, 0, 0, 0
- byte 0, 7, 0, 0, 4, 0, 0, 0, 1
- byte 3, 0, 0, 0, 2, 0, 0, 0, 6
- byte 0, 0, 8, 0, 0, 0, 5, 0, 0
- byte 8, 0, 0, 0, 9, 0, 0, 0, 3
- byte 1, 0, 0, 0, 3, 0, 0, 7, 0
- byte 0, 0, 0, 0, 0, 0, 0, 4, 0
- byte 0, 0, 1, 9, 0, 7, 0, 0, 0
- _4blk
- _5num
- byte 0, 0, 7, 0, 0, 3, 9, 0, 2
- byte 0, 0, 0, 8, 0, 0, 0, 0, 0
- byte 9, 4, 3, 0, 0, 0, 0, 0, 7
- byte 6, 9, 0, 0, 0, 0, 0, 0, 0
- byte 3, 0, 0, 5, 2, 7, 0, 0, 0
- byte 0, 0, 0, 0, 0, 0, 8, 4, 0
- byte 0, 0, 0, 0, 4, 8, 0, 0, 0
- byte 2, 6, 0, 0, 0, 0, 0, 0, 0
- byte 0, 0, 0, 0, 0, 0, 1, 2, 9
- _5blk
- byte 1, 1, 1, 2, 2, 2, 3, 3, 3
- byte 1, 1, 1, 2, 2, 2, 3, 3, 3
- byte 1, 1, 1, 2, 2, 2, 3, 3, 3
- byte 4, 4, 4, 5, 5, 5, 6, 6, 6
- byte 4, 4, 4, 5, 5, 5, 6, 6, 6
- byte 4, 4, 4, 5, 5, 5, 6, 6, 6
- byte 7, 7, 7, 8, 8, 8, 9, 9, 9
- byte 7, 7, 7, 8, 8, 8, 9, 9, 9
- byte 7, 7, 7, 8, 8, 8, 9, 9, 9
- _6num
- byte 0, 2, 0, 0, 0, 0, 0, 8, 6
- byte 8, 0, 7, 0, 0, 5, 0, 0, 0
- byte 0, 0, 3, 0, 4, 0, 0, 0, 2
- byte 0, 5, 0, 7, 9, 0, 0, 0, 0
- byte 0, 0, 1, 0, 5, 0, 2, 0, 0
- byte 0, 0, 0, 0, 2, 6, 0, 7, 0
- byte 5, 0, 0, 0, 3, 0, 1, 4, 0
- byte 0, 0, 0, 4, 0, 0, 0, 0, 5
- byte 9, 1, 0, 0, 0, 0, 0, 2, 0
- _6blk
- ;--------------------------------------
- ; Call with
- ; .X = value of horizontal pos
- ; .Y = value of vertical pos
- ;
- ; thanx to Phaze101
- ;--------------------------------------
- SetCurs
- lda #0
- sta _pnt1
- sta _pnt1+1
- cpy #0 ;first line: no need to add rows
- beq AddColumn-1
- ;clc
- CalcRow ;Use an addition to calculate rows
- tya ;2 max(Y)=25
- asl ;2 A= Y x 2
- asl ;2 A= Y x 4
- sty _pnt1 ;3
- adc _pnt1 ;3 A= Y x 5
- asl ;2 A= Y x 10 (still contained in one byte)
- asl ;2 A= Y x 20 (now needs two bytes)
- rol _pnt1+1 ;5 flows on high byte
- asl ;2 A= Y x 40
- rol _pnt1+1 ;5 flows on high byte
- sta _pnt1 ;3 stores on low byte
- clc
- AddColumn
- txa
- adc _pnt1
- sta _pnt1
- bcc AddScrBase
- inc _pnt1+1
- clc ;Add position to base address
- AddScrBase
- ;lda _pnt1
- adc #<ScrnBase
- sta _pnt2
- lda #>ScrnBase
- adc _pnt1+1
- sta _pnt2+1
- rts
- ;--------------------------------------
- ; PrintAt, ChainPrint
- ; Call with
- ; .A = low byte of the string
- ; .X = high byte of the string
- ;
- ; thanx to Phaze101
- ;--------------------------------------
- PrintAt
- ldy #$0
- sta _pnt1
- stx _pnt1+1
- jmp _ln
- _PrtLoop
- sta (_pnt2),y
- iny
- _ln lda (_pnt1),y
- bne _PrtLoop
- rts
- ChainPrint
- sta _pnt1
- stx _pnt1+1
- tya
- ldy #0
- clc
- adc _pnt2
- sta _pnt2
- bcc _ln
- inc _pnt2+1
- bcs _ln
- ;--------------------------------------
- ; Call with
- ; .A = value of the character to use to fill the screen
- ;
- ; thanx to Phaze101
- ;--------------------------------------
- ClearScreen ldx #+200 ; init index
- sta $2
- ClrLoop lda $2
- sta ScrnBase-1,x ; 1023
- sta ScrnBase+199,x ; 1023 + 200
- sta ScrnBase+399,x ; 1023 + 400
- sta ScrnBase+599,x ; 1023 + 600
- sta ScrnBase+799,x ; 1023 + 800
- tya
- sta ScrnCol-1,x
- sta ScrnCol+199,x
- sta ScrnCol+399,x
- sta ScrnCol+599,x
- sta ScrnCol+799,x
- dex
- bne ClrLoop
- rts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement