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,3 @@
MOVE.L #$FFFFFF00,D0
CMP.B #0,D0 ;equals zero, so zero flag is set.
CMP.W #0,D0 ;doesn't equals zero, so zero flag is clear.

View file

@ -0,0 +1,3 @@
BTST #7,D0 ;test bit 7 of D0, i.e. the leftmost bit in the rightmost byte.
BNE goHere ;if that bit is 1, branch to "goHere"
BEQ goThere ;if that bit is 0, branch to "goThere"

View file

@ -0,0 +1,5 @@
CMP.L #3,D0 ;this works with any size operands, not just L.
BNE doNothing
ADD.L #7,D0
doNothing:
;rest of program

View file

@ -0,0 +1,34 @@
SwitchCase:
DC.L foo,bar,baz,default ;case 0, case 1, case 2, case 3. (Case 0,1,2 are the "valid" cases.)
; D0 is the case selector variable (byte-sized)
doSwitchCase: ;this is a subroutine that gets called elsewhere.
LEA SwitchCase,A0
;this is our bounds check
CMP.B #3,D0 ;is D0 > 3?
BLS InBounds ;if not, keep going
MOVE.B #3,D0 ;if it is, set it to 3.
InBounds:
LSL.W #2,D0 ;multiply by 4 to index into a table of longs
MOVE.L (A0,D0),A0 ;deref the pointer and store the desired routine in A0
MOVE.L A0,-(SP) ;push it onto the stack
RTS ;"return" to the selected routine. If it ends in an RTS,
; that RTS will return to just after "JSR doSwitchCase"
foo:
;your code for this case goes here.
rts
bar:
;your code for this case goes here.
rts
baz:
;your code for this case goes here.
rts
default:
rts