|
|
DataMuseum.dkPresents historical artifacts from the history of: Bogika Butler |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Bogika Butler Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 3200 (0xc80)
Types: TextFile
Names: »CPMINT.ZAS«
└─⟦63c65de3f⟧ Bits:30009789/_.ft.Ibm2.50007335.imd Mogens Pelles Zilog 80,000 / EOS projekt
└─⟦this⟧ »CPMINT.ZAS«
$module CPM_INTERFACE $title 'CP/M Interface Routines' ; Contains Global subroutines for Z-8000 programs ; requesting I/O. ; ; The appropriate CP/M call is made by the host CPU ; (either an 8080, 8085 or Z-80) ; through the ZEX run-time host monitor. ; ; V1.1 - Copyright 1981, Western Wares, Placerville, CO 81430 ; ;$include 'ZEXZ.LIB' $list off $include 'ZEXZ.LIB' ; Define symbols used by ZEX $list on ; ; Define Global Entry Points ; GLOBAL CONSOLE_IN, CONSOLE_OUT, CONSOLE_STATUS GLOBAL CONSOLE_INPUT, CONSOLE_MESSAGE GLOBAL CONSOLE_HEX_BYTE, CONSOLE_HEX_WORD, CONSOLE_HEX_LWORD GLOBAL BIN_TO_HEX_B, BIN_TO_HEX_W, BIN_TO_HEX_L GLOBAL EXIT $psect CONSOLE_IO CONSOLE_STATUS: ; ; Return %FF in RL0 if a keyboard character is ready ; LDB RL0,#CST JR SYS_CALL CONSOLE_IN: ; ; Return one character in RL0 read from the console ; LDB RL0,#CIN ; BDOS Function JR SYS_CALL CONSOLE_OUT: ; ; Output one character from RL2 ; LDB RL0,#COT JR SYS_CALL CONSOLE_INPUT: ; ; R2 Points to buffer ; LDB RL0,#BIN ; BDOS function SYS_CALL: LD R1,R2 ; Buffer pointer SC #TO_CPM ; Host CPU will now call CP/M to perform the I/O RET ; Back from CP/M CONSOLE_MESSAGE: ; ; R2 Points to a Message, '$' terminated ; LDB RL0,#MSG ; Console message JR SYS_CALL BIN_TO_HEX_B: ; ; Binary value in RL2 is converted to ASCII Hexidecimal ; in R7 ; RLDB RH2,RL2 ; RH2 = High nibble CALR HEX_NIBBLE LDB RH7,RH2 RLDB RH2,RL2 ; RH2 = low nibble CALR HEX_NIBBLE LDB RL7,RH2 RET ; HEX_NIBBLE: ANDB RH2,#%0F ; Mask high nibble CPB RH2,#10 JR ULT,NO_ADD INCB RH2,#7 ; Offset for alpha hex NO_ADD: ADDB RH2,#'0' ; Convert to ASCII RET BIN_TO_HEX_L: ; ; Convert the long word in RR2 ; to hexidecimal in RQ8 ; EX R2,R3 ; Low word first CALR BIN_TO_HEX_W ; Convert to hex in RR8 LDL RR10,RR8 ; Store in low hex position LD R2,R3 ; Recover high word CALR BIN_TO_HEX_W RET BIN_TO_HEX_W: ; ; Binary value in R2 is converted to ASCII Hexidecimal ; in RR8 ; EX R1,R2 ; Save in R1 LDB RL2,RH1 ; High byte CALR BIN_TO_HEX_B ; To hex in R7 LD R8,R7 LDB RL2,RL1 ; Get low byte CALR BIN_TO_HEX_B LD R9,R7 RET CONSOLE_HEX_BYTE: ; ; Output RL2 to the console in hexidecimal ; CALR BIN_TO_HEX_B ; Convert to hex LD HEX_BUF,R7 ; Store in buffer LDB HEX_BUF+2,#'$' ; Terminate string OUT_HEX_BUF: LD R2,#HEX_BUF CALR CONSOLE_MESSAGE RET CONSOLE_HEX_WORD: ; ; Output R2 to the console in hexidecimal ; CALR BIN_TO_HEX_W ; Convert to hex in RR8 LDL HEX_BUF,RR8 LDB HEX_BUF+4,#'$' ; Terminate string JR OUT_HEX_BUF CONSOLE_HEX_LWORD: ; ; Output RR2 to the console in hexidecimal ; CALR BIN_TO_HEX_L ; Convert to hex in RQ8 LD R1,#HEX_BUF LDL @R1,RR8 INC R1,#4 LDL @R1,RR10 INC R1,#4 LDB @R1,#'$' ; Terminate string JR OUT_HEX_BUF $PSECT CONSOLE_IO_DATA HEX_BUF: DS 9 ; Buffer for ASCII hex strings $eject $psect CPM_EXIT EXIT: ; ; Pass the appropriate code to ZEX to do a warm boot ; SC #WARM_BOOT END «eof»