Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Enumerations/Z80-Assembly/enumerations-1.z80
Normal file
7
Task/Enumerations/Z80-Assembly/enumerations-1.z80
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Sunday equ 0
|
||||
Monday equ 1
|
||||
Tuesday equ 2
|
||||
Wednesday equ 3
|
||||
Thursday equ 4
|
||||
Friday equ 5
|
||||
Saturday equ 6
|
||||
33
Task/Enumerations/Z80-Assembly/enumerations-2.z80
Normal file
33
Task/Enumerations/Z80-Assembly/enumerations-2.z80
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
align 8 ;aligns "Days_Of_The_Week" to the next 256-byte boundary. The low byte of "Sunday" will be at memory location &XX00.
|
||||
;this simplifies the lookup process significantly.
|
||||
Days_Of_The_Week:
|
||||
word Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
|
||||
|
||||
Sunday:
|
||||
byte "Sunday",0
|
||||
Monday:
|
||||
byte "Monday",0
|
||||
Tuesday:
|
||||
byte "Tuesday",0
|
||||
Wednesday:
|
||||
byte "Wednesday",0
|
||||
Thursday:
|
||||
byte "Thursday",0
|
||||
Friday:
|
||||
byte "Friday",0
|
||||
Saturday:
|
||||
byte "Saturday",0
|
||||
|
||||
;This example will load Friday.
|
||||
ld hl,Days_Of_The_Week ;get base address of table. (Thanks to the align 8, we know that L = 0.)
|
||||
ld a,5 ;0 = Sunday, 1 = Monday, ... 5 = Friday, 6 = Saturday
|
||||
add a ;Multiply A by 2 (this is faster than SLA A. RLCA would have also worked here)
|
||||
ld L,a ;since the table was page-aligned it is sufficient to load A directly into L to properly index the table.
|
||||
ld e,(hl) ;get the low byte into E
|
||||
inc hl ;increment HL to high byte
|
||||
ld d,(hl) ;get the high byte into D
|
||||
|
||||
;now DE contains the pointer to "Friday"
|
||||
ex de,hl ;my PrintString routine takes the pointer in HL as the argument so we need to swap DE with HL.
|
||||
call PrintString ;prints a null-terminated string to the screen.
|
||||
ret ;return to basic
|
||||
Loading…
Add table
Add a link
Reference in a new issue