Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1 @@
JMP PrintChar ; jump to the label "PrintChar" where a routine to print a letter to the screen is located.

View file

@ -0,0 +1,5 @@
lda #<PrintChar ;load into A the low byte of the address that PrintChar references.
sta $00
lda #>PrintChar ;load into A the high byte of the address that PrintChar references.
sta $01 ;these need to be stored low then high because the 6502 is a little-endian cpu
JMP ($00) ;dereferences to JMP PrintChar

View file

@ -0,0 +1,8 @@
JumpTable_Lo: db <PrintChar, <WaitChar, <ReadKeys, <MoveMouse ;each is the low byte of a memory address
JumpTable_Hi: db >PrintChar, >WaitChar, >ReadKeys, >MoveMouse ;each is the high byte of a memory address
lda JumpTable_Lo,x
sta $10
lda JumpTable_Hi,x
sta $11
JMP ($0010)

View file

@ -0,0 +1,5 @@
.org $8000
JMP PrintChar
JMP WaitChar
JMP ReadKeys
JMP MoveMouse

View file

@ -0,0 +1,7 @@
lda $80
sta $21
txa
clc
adc #$03
sta $20
JMP ($0020)

View file

@ -0,0 +1,7 @@
JumpTable:
word PrintChar
word PrintString
word MoveMouse
ldx #$02
JMP (JumpTable,x) ;dereferences to JMP PrintString

View file

@ -0,0 +1 @@
ReturnTable: dw PrintChar-1,WaitChar-1,ReadKeys-1,MoveMouse-1

View file

@ -0,0 +1,15 @@
;execution is currently here
JSR UseReturnTable ;the address just after this label is pushed onto the stack.
;the chosen subroutine's RTS will bring you here.
UseReturnTable: ;pretend this is somewhere far away from where execution is, its distance doesn't matter.
ASL ;double the value of the variable, because this is a table of words.
TAX
LDA ReturnTable+1,x ;load the chosen subroutine's high byte into the accumulator
PHA ;push it onto the stack
LDA ReturnTable,x ;load the chosen subroutine's low byte into the accumulator
PHA ;push it onto the stack.
RTS ;this "RTS" actually takes you to the desired subroutine.
;The top two bytes of the stack are popped, the low byte is incremented by 1,
;and this value becomes the new program counter.