Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,55 @@
|
|||
define z_HL $00
|
||||
define z_L $00
|
||||
define z_H $01
|
||||
define temp $02
|
||||
define temp2 $03
|
||||
|
||||
set_table:
|
||||
dex
|
||||
txa
|
||||
sta $1200,y
|
||||
iny
|
||||
bne set_table ;stores $ff at $1200, $fe at $1201, etc.
|
||||
|
||||
lda #$12
|
||||
sta z_H
|
||||
lda #$00
|
||||
sta z_L
|
||||
|
||||
lda #0
|
||||
tax
|
||||
tay ;clear regs
|
||||
|
||||
JSR BUBBLESORT
|
||||
BRK
|
||||
|
||||
BUBBLESORT:
|
||||
lda (z_HL),y
|
||||
sta temp
|
||||
iny ;look at the next item
|
||||
lda (z_HL),y
|
||||
dey ;go back 1 to the "current item"
|
||||
sta temp2
|
||||
cmp temp
|
||||
bcs doNothing
|
||||
|
||||
;we had to re-arrange an item.
|
||||
lda temp
|
||||
iny
|
||||
sta (z_HL),y ;store the higher value at base+y+1
|
||||
inx ;sort count. If zero at the end, we're done.
|
||||
dey
|
||||
lda temp2
|
||||
sta (z_HL),y ;store the lower value at base+y
|
||||
|
||||
doNothing:
|
||||
iny
|
||||
cpy #$ff
|
||||
bne BUBBLESORT
|
||||
ldy #0
|
||||
txa ;check the value of the counter
|
||||
beq DoneSorting
|
||||
ldx #0 ;reset the counter
|
||||
jmp BUBBLESORT
|
||||
DoneSorting:
|
||||
rts
|
||||
Loading…
Add table
Add a link
Reference in a new issue