![]() |
Amstrad Cpc
Rom code sample with programmable basic instructions (Resident
System eXtension)
.org 0C000h .db 1 ; 0C000h Rom type=BackGround Rom ; version 1.23 .db 1 ; 0C001h Rom Mark Number .db 2 ; 0C002h Rom Version Number .db 3 ; 0C003h Rom Modif Level .dw MnemoTb ; 0C004h address table of the names which will be ; used to call the routines via the BASIC jp RomIni ; 0C006h first vector. This vector will be automatically ; called after each Cpc system initialization jp command1 ; 0C009h second vector jp command2 ; 0C00Ch ... ; names table MnemoTb .db "ROMIN" ; |ROMINI (execute the subrutine "RomIni") .db 049h | 080h ; "I" or 080h .db "NAME" ; |NAME1 (execute the subrutine "command1") .db 031h | 080h ; "1" or 080h .db "NAME" ; |NAME2 (execute the subrutine "command2") .db 032h | 080h ; "2" or 080h .db 0 ; 0=mark "end of table" ; remark: ; The end of each name is indicated by setting the bit 7 on the last letter. ; To call the command, it will be enough to type the name preceded by the sign "vertical bar | ", from the Cpc BASIC interpreter. RomIni: push hl ld hl,IniMes ; message to be posted with starting (zero terminated) call TxtPost pop hl scf ; carry = ok ret command1: ld hl,Ok1Mes ; message to be posted call TxtPost ret command2: ld hl,Ok2Mes ; message to be posted call TxtPost ret IniMes .db " Program V1.23",10,13,0 Ok1Mes .db "OK1",10,13,0 Ok2Mes .db "OK2",10,13,0 ; ** POST TEXT ** ; <HL=offset first character of the zero terminated text TxtPost: ld a,(hl) inc hl or a ; end of message ? ret z ; yes>return call 0BB5Ah ; system vector "Post character" jr TxtPost .end |