Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
- DEVICE ZXSPECTRUM48
- CSPECTMAP "wifiprn.map"
- org $8000
- header:
- ;------------------------------------------------------------------------------
- ; Driver header
- db "NDRV" ; .DRV Signature
- db "P" ; Driver ID - "P" standard printer device
- db relocate_count ; Number of relocations
- db 0 ; Number of 8K DivMMC RAM banks needed
- db 0 ; Number of 8K Spectrum RAM banks needed
- disp $0000 ; Driver entry point starts at $0000
- RELOCATE_START HIGH
- ;------------------------------------------------------------------------------
- ; Driver code
- entry:
- ld a, b
- cp $fb ; Output character
- jp z, output_char ; Use jp so that we get relocation generated
- cp $7f ; Get device status
- jp z, get_status ; Use jp so that we get relocation generated
- .error
- xor a ; A=0 unsupported call id
- scf ; CY=1 indicates and error
- ret
- ;-----------------------------------------------------------------------------
- ; Call ID - $fb
- ; output_char
- ; E - char to print
- output_char:
- ld a, e ; Get char to print
- and %00000111 ; Mask the lower bits to us as a border color
- out ($fe), a ; Write the border color
- or a ; Clear the carry flag to indicate no error
- ret
- ;------------------------------------------------------------------------------
- ; Call ID - $7f
- ; get_status
- get_status:
- ld bc, $133b
- or a ; Clear the carry flag to indicate success
- in a, (c) ; Read the UART status
- bit 1, a ; Test the TX Busy flag
- ld bc, $ffff ; Assume not busy
- ret z
- inc bc ; Printer is not ready
- ret
- RELOCATE_END
- ; Pad driver to 512
- ASSERT $ <= 512, Driver image exceeds 512 bytes
- ds 512-$, 0
- ;------------------------------------------------------------------------------
- ; Relocation table placed after driver image
- relocator_table:
- RELOCATE_TABLE
- ;------------------------------------------------------------------------------
- ; Output configuration
- image_size EQU $$$-header ; Size includes the header, code and relocation table
- SAVEBIN "wifiprn.drv", $8000, image_size
Add Comment
Please, Sign In to add comment